import { View } from "../../../mvc/core/View";
import { EBattlefieldPlayerState } from "../../model/defin/EBattlefieldPlayerState";
import { LayerManager } from "../../manager/LayerManager";
import { BattlefieldIconView } from "./BattlefieldIconView";
import { BattleMiniScoreView } from "./BattleMiniScoreView";
import { SMyScore } from "../../../../Message/Public/SMyScore";
import { SAttribute } from "../../../../Message/Public/SAttribute";
import { SActiveToClient } from "../../../../Message/Public/SActiveToClient";
type int = number;
//class BattleUIView
    
    export  class BattleUIView extends View
    {
        constructor()
        {
            super();
            this.currentState = EBattlefieldPlayerState.EBattlefieldStatusClose;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this.initBase();
            this.createChildren();
            this.mouseEnabled = false;
            return;
        }

        /* internal  */initBase(): void
        {
            this.layer = LayerManager.uiLayer;
            this.x = 10;
            this.y = 140;
            return;
        }

        /* internal  */createChildren(): void
        {
            this._iconView = new BattlefieldIconView();
            this._scoreView = new BattleMiniScoreView();
            return;
        }

        public BattleUIView.get state(): EBattlefieldPlayerState
        {
            return this.currentState;
        }

        public set state(arg1: EBattlefieldPlayerState)
        {
            this.currentState = arg1;
            this._iconView.state = arg1;
            var loc1=arg1;
            switch (loc1) 
            {
                case EBattlefieldPlayerState.EBattlefieldStatusClose:
                {
                    this._iconView.hide();
                    this._scoreView.hide();
                    this._scoreView.stopCountDown();
                    break;
                }
                case EBattlefieldPlayerState.EBattlefieldStatusOpen:
                {
                    this._iconView.hide();
                    this._scoreView.show();
                    this._iconView.stopLimitEnterCountDown();
                    break;
                }
                case EBattlefieldPlayerState.EBattlefieldStatusWait:
                {
                    this._iconView.show();
                    this._scoreView.hide();
                    break;
                }
            }
            return;
        }

        public showLightMask(): void
        {
            this._iconView.showLightMask();
            return;
        }

        public hideLightMask(): void
        {
            this._iconView.hideLightMask();
            return;
        }

        public updateMyScore(arg1: SMyScore): void
        {
            this._scoreView.updateMyScore(arg1);
            return;
        }

        public updateCampScore(arg1: int, arg2: int, arg3: int): void
        {
            this._scoreView.updateCampScore(arg1, arg2, arg3);
            return;
        }

        public startCountdown(arg1: Date): void
        {
            this._scoreView.startCountdown(arg1);
            return;
        }

        public startCountdownLimitEnter(arg1: Date): void
        {
            this._iconView.startCountdownLimitEnter(arg1);
            return;
        }

        public updateUnionState(arg1: SAttribute): void
        {
            this._scoreView.updateUnionState(arg1);
            return;
        }

        public updateActiveReward(arg1: SActiveToClient): void
        {
            if (this._iconView && !this._iconView.isHide) 
            {
                this._iconView.updateActiveToClientInfo(arg1);
            }
            return;
        }

        public static get instance(): BattleUIView
        {
            if (!BattleUIView._instance) 
            {
                BattleUIView._instance = new BattleUIView();
            }
            return BattleUIView._instance;
        }

        /* internal */ /* var */_iconView: BattlefieldIconView;

        /* internal */ /* var */_scoreView: BattleMiniScoreView;

        /* internal */ /* var */currentState: EBattlefieldPlayerState;

        /* internal */ static /* var */_instance: BattleUIView;
    }
